package org.zsl.mybatis.app;

import org.apache.ibatis.session.SqlSession;
import org.zsl.mybatis.mapper.ProductMapper;
import org.zsl.mybatis.model.Product;
import org.zsl.mybatis.util.SqlSessionFactory;

import java.io.IOException;

public class Client4 {

    public static void main(String[] args) throws IOException {


        SqlSession session = SqlSessionFactory.getSqlSession();

        ProductMapper mapper= session.getMapper(ProductMapper.class);

        Product product = new Product();
        product.setProductId(1);
        product.setName("A");
        product.setPrice(1000);

        int affected=     mapper.update(product);
        System.out.println(affected);

        session.commit();
        session.close();
    }
}
